Conditions | 1 |
Paths | 1 |
Total Lines | 109 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | define(['d3-interpolate'], function (d3Interpolate) { |
||
2 | return { |
||
3 | linkScale: d3Interpolate.interpolate('#F02311', '#04C714'), |
||
4 | backgroundScale: d3Interpolate.interpolate('#770038', '#DC0067'), |
||
5 | map: { |
||
6 | node: { |
||
7 | online: { |
||
8 | color: '#1566A9', |
||
9 | fillColor: '#1566A9', |
||
10 | radius: 6, |
||
11 | fillOpacity: 0.5, |
||
12 | opacity: 0.5, |
||
13 | weight: 2, |
||
14 | className: 'stroke-first' |
||
15 | }, |
||
16 | offline: { |
||
17 | color: '#D43E2A', |
||
18 | fillColor: '#D43E2A', |
||
19 | radius: 3, |
||
20 | fillOpacity: 0.5, |
||
21 | opacity: 0.5, |
||
22 | weight: 1, |
||
23 | className: 'stroke-first' |
||
24 | }, |
||
25 | lost: { |
||
26 | color: '#D43E2A', |
||
27 | fillColor: '#D43E2A', |
||
28 | radius: 4, |
||
29 | fillOpacity: 0.8, |
||
30 | opacity: 0.8, |
||
31 | weight: 1, |
||
32 | className: 'stroke-first' |
||
33 | }, |
||
34 | alert: { |
||
35 | color: '#D43E2A', |
||
36 | fillColor: '#D43E2A', |
||
37 | radius: 5, |
||
38 | fillOpacity: 0.8, |
||
39 | opacity: 0.8, |
||
40 | weight: 2, |
||
41 | className: 'stroke-first' |
||
42 | }, |
||
43 | new: { |
||
44 | color: '#1566A9', |
||
45 | fillColor: '#93E929', |
||
46 | radius: 6, |
||
47 | fillOpacity: 1.0, |
||
48 | opacity: 0.5, |
||
49 | weight: 2 |
||
50 | } |
||
51 | }, |
||
52 | locationMarker: { |
||
53 | outerCircle: { |
||
54 | stroke: false, |
||
55 | color: '#4285F4', |
||
56 | opacity: 1, |
||
57 | fillOpacity: 0.3, |
||
58 | clickable: false, |
||
59 | radius: 16 |
||
60 | }, |
||
61 | innerCircle: { |
||
62 | stroke: true, |
||
63 | color: '#ffffff', |
||
64 | fillColor: '#4285F4', |
||
65 | weight: 1.5, |
||
66 | clickable: false, |
||
67 | opacity: 1, |
||
68 | fillOpacity: 1, |
||
69 | radius: 7 |
||
70 | }, |
||
71 | accuracyCircle: { |
||
72 | stroke: true, |
||
73 | color: '#4285F4', |
||
74 | weight: 1, |
||
75 | clickable: false, |
||
76 | opacity: 0.7, |
||
77 | fillOpacity: 0.2 |
||
78 | } |
||
79 | } |
||
80 | }, |
||
81 | forcegraph: { |
||
82 | zoomMin: 1 / 8, |
||
83 | zoomMax: 3, |
||
84 | force: { |
||
85 | alpha: 0.3, |
||
86 | distance: { |
||
87 | vpn: 0, |
||
88 | other: 75 |
||
89 | }, |
||
90 | strength: { |
||
91 | vpn: 0.02, |
||
92 | center: 0.02, |
||
93 | other: 0.5 |
||
94 | } |
||
95 | }, |
||
96 | node: { |
||
97 | radiusDraw: 8, |
||
98 | radiusDrag: 10, |
||
99 | radiusHightlight: 20, |
||
100 | radiusSelect: 15 |
||
101 | }, |
||
102 | link: { |
||
103 | radiusDraw: 12, |
||
104 | radiusSelect: 12, |
||
105 | radiusHightlight: 24 |
||
106 | } |
||
107 | } |
||
108 | }; |
||
109 | }); |
||
110 |